package com.imooc.common.result;

/**
 * @ClassName: ResponseUtils
 * @Description:
 * @author: limingxing
 * @Date: 2019-12-23 16:26
 */
public class ResponseUtils<T> {

    private ResponseData<T> responseData;

    public ResponseUtils() {
        responseData = new ResponseData<>();
        responseData.setSuccess(true);
        responseData.setMsg("success");
        responseData.setStatus(200);
    }


    public static ResponseData build(Integer status, String msg, Object data) {
        return new ResponseData(status, msg, data);
    }

    public static ResponseData build(Integer status, String msg, Object data, String ok) {
        return new ResponseData(status, msg, data, ok);
    }

    public static ResponseData success(Object data) {
        return new ResponseData(data);
    }

    public static ResponseData success() {
        return new ResponseData(null);
    }

    public static ResponseData errorMsg(String msg) {
        return new ResponseData(500, msg, null);
    }

    public static ResponseData errorMap(Object data) {
        return new ResponseData(501, "error", data);
    }

    public static ResponseData errorTokenMsg(String msg) {
        return new ResponseData(502, msg, null);
    }

    public static ResponseData errorException(String msg) {
        return new ResponseData(555, msg, null);
    }

    public static ResponseData errorUserQQ(String msg) {
        return new ResponseData(556, msg, null);
    }


}
